package com.bestcem.xm.ticket.grpc.client.enums;

import lombok.Getter;

/**
 * 列状态
 *
 * @author zq.ding <zq.ding@idiaoyan.com>
 * @version v1.0
 * @date 2021/8/27 15:00
 */
@Getter
public enum ColumnStatusEnum {

    /**
     * 显示
     */
    COLUMN_STATUS_SHOW("删除", 0),
    /**
     * 隐藏
     */
    COLUMN_STATUS_HIDE("删除", 1),
    /**
     * 删除
     */
    COLUMN_STATUS_DELETE("删除", 2);

    private final String name;
    private final Integer index;

    ColumnStatusEnum(String name, Integer index) {
        this.name = name;
        this.index = index;
    }

    /**
     * 根据 index 获取枚举实体
     * 找不到则返回 null
     *
     * @param index 枚举index
     * @author zq.ding <zq.ding@idiaoyan.com>
     * @date 2021/8/31 13:35
     */
    public static ColumnStatusEnum getByIndex(Integer index) {
        for (ColumnStatusEnum value : values()) {
            if (value.getIndex().equals(index)) {
                return value;
            }
        }
        return null;
    }
}
